package com.batdream.message.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * @author Wang Chen Peng
 * @date 2019/01/02
 * describe:
 */
@Component
public class SpringUtil implements ApplicationListener<ContextRefreshedEvent> {

    private static ApplicationContext applicationContext;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        applicationContext = event.getApplicationContext();
    }

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }
}
